function [residual, g1, g2, g3] = twosb_v10b_mobileKNoFItfpNoMe_dynamic(y, x, params, steady_state, it_)
%
% Status : Computes dynamic model for Dynare
%
% Warning : this file is generated automatically by Dynare
%           from model file (.mod)

%
% Model equations
%

residual = zeros(162, 1);
crho__ = 1/(params(40)-1);
T3 = (-1);
T29 = params(83)^(-crho__);
T31 = params(84)^(-crho__);
T33 = (T29+T31)^T3;
T48 = 1/(1-params(8));
T52 = exp((-T48)*params(87));
T157 = params(7)/(1-params(8));
T160 = exp(params(86)+params(87)*T157);
T173 = (exp(2*(params(86)+params(87)*T157))+params(85)*params(16)^2)/((T160-params(85)*params(16))*(T160-params(16)));
T195 = T157*(params(85)*params(16)*T160*params(30)-params(16)*T160)/((T160-params(85)*params(16))*(T160-params(16)));
T217 = T48*y(310);
T349 = params(85)/(1+params(85));
T366 = (1-params(85)*params(18))*(1-params(18))/((1+params(85))*params(18)*(1+params(23)*(1+1/params(45))));
T375 = params(17)/(1+params(85));
T380 = (1+params(85)*params(17))/(1+params(85));
T457 = 1/(params(68)+(1-params(14))*params(101));
T476 = 1/(params(68)+(1-params(13))*params(102));
T492 = params(12)*exp(params(87)*2/(1-params(8)));
T495 = params(12)*params(85)*exp(params(87)*2/(1-params(8)));
lhs =y(154);
rhs =params(88)*(params(8)*y(139)+(1-params(8))*y(135)+y(169)+y(211));
residual(1)= lhs-rhs;
lhs =y(154);
rhs =T29*T33*y(152)+T31*T33*y(153);
residual(2)= lhs-rhs;
lhs =y(151)+params(68)*params(80)/params(75)*T52*y(144)+T52*params(68)*params(81)/params(75)*y(145);
rhs =params(88)*(y(211)+params(7)*y(138)+(1-params(7))*y(136)+y(168));
residual(3)= lhs-rhs;
lhs =y(142);
rhs =params(7)*y(146)+(1-params(7))*y(158)-y(168)-y(211);
residual(4)= lhs-rhs;
lhs =y(143);
rhs =params(8)*y(146)+(1-params(8))*y(158)-y(147)-y(169)-y(211);
residual(5)= lhs-rhs;
lhs =y(146)-y(158);
rhs =y(136)-y(138);
residual(6)= lhs-rhs;
lhs =y(146)-y(158);
rhs =y(135)-y(139);
residual(7)= lhs-rhs;
lhs =y(156)-y(186);
rhs =params(85)/(1+params(85)*params(19))*(y(306)-y(186))+params(19)/(1+params(85)*params(19))*(y(9)-y(186))+y(142)*(1-params(20))*(1-params(85)*params(20))/((1+params(85)*params(19))*params(20))+y(184);
residual(8)= lhs-rhs;
lhs =y(157)-y(186);
rhs =params(85)/(1+params(85)*params(21))*(y(307)-y(186))+params(21)/(1+params(85)*params(21))*(y(10)-y(186))+y(143)*(1-params(22))*(1-params(85)*params(22))/((1+params(85)*params(21))*params(22))+y(185);
residual(9)= lhs-rhs;
lhs =y(148);
rhs =params(85)*params(16)*T160/((T160-params(85)*params(16))*(T160-params(16)))*y(303)-y(151)*T173+params(16)*T160/((T160-params(85)*params(16))*(T160-params(16)))*y(4)+(params(85)*params(16)*T160*params(29)-params(16)*T160)/((T160-params(85)*params(16))*(T160-params(16)))*y(160)+y(162)+T195*y(161);
residual(10)= lhs-rhs;
lhs =y(148);
rhs =y(159)+y(300)-y(309)-params(7)*y(310)/(1-params(8))-y(306);
residual(11)= lhs-rhs;
lhs =y(149);
rhs =T52*params(85)*(1-params(13))*(y(301)-T217+y(312))+(1-T52*params(85)*(1-params(13)))*(y(312)+y(300)-T217+y(299)+y(297));
residual(12)= lhs-rhs;
lhs =y(150);
rhs =T52*params(85)*(1-params(14))*(y(302)-T217+y(311))+(1-T52*params(85)*(1-params(14)))*(y(311)+y(300)-T217+y(299)+y(298));
residual(13)= lhs-rhs;
lhs =y(146);
rhs =y(144)*params(9);
residual(14)= lhs-rhs;
lhs =y(146);
rhs =y(145)*params(10);
residual(15)= lhs-rhs;
lhs =y(148);
rhs =params(12)*params(85)*exp(2*T48*params(87))*(T217+y(304)-y(152))+y(164)+y(149)-y(147)-exp(2*T48*params(87))*params(12)*(y(152)-y(5)+T48*y(161))-(1+crho__)*(T33*(T31*y(153)+T29*y(152))-y(152));
residual(16)= lhs-rhs;
lhs =y(148);
rhs =params(12)*params(85)*exp(2*T48*params(87))*(T217+y(305)-y(153))+y(164)+y(150)-y(147)-exp(2*T48*params(87))*params(12)*(T48*y(161)+y(153)-y(6))-(1+crho__)*(T33*(T31*y(153)+T29*y(152))-y(153));
residual(17)= lhs-rhs;
lhs =y(139);
rhs =y(144)+y(1)+y(188)-T48*y(161);
residual(18)= lhs-rhs;
lhs =y(138);
rhs =y(145)+y(2)+y(187)-T48*y(161);
residual(19)= lhs-rhs;
lhs =params(81)*y(141)+params(81)*y(140);
rhs =T52*(1-params(14))*(params(81)*y(2)+params(81)*y(187)-y(161)*T48*params(81))+T52*(1-params(13))*(params(80)*y(1)+params(80)*y(188)-y(161)*params(80)*T48)+(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13)))*(y(154)+y(164));
residual(20)= lhs-rhs;
lhs =y(158);
rhs =1/(1+params(85))*y(11)+T349*y(308)-T366*(y(148)+y(158)-params(23)*y(137)-y(162))+(y(9)-y(186))*T375-(y(156)-y(186))*T380+(y(306)-y(186))*T349+T375*(y(13)+T157*y(14))-y(160)*(1+params(85)*params(17)-params(85)*params(29))/(1+params(85))-y(161)*T157*(1+params(85)*params(17)-params(85)*params(30))/(1+params(85))+y(166);
residual(21)= lhs-rhs;
lhs =y(137);
rhs =y(136)*params(73)/params(46)+y(135)*params(74)/params(46);
residual(22)= lhs-rhs;
lhs =y(155);
rhs =y(151)*params(75)/params(82)+params(69)*params(76)/params(82)*(y(154)+y(147))+y(163);
residual(23)= lhs-rhs;
lhs =y(159);
rhs =y(156)*params(25)*(1-params(28))+(1-params(28))*params(26)*(y(155)-y(8))+params(28)*y(12)+y(165);
residual(24)= lhs-rhs;
lhs =y(157)-y(156);
rhs =y(147)-y(3);
residual(25)= lhs-rhs;
lhs =y(191);
rhs =y(160)+y(187)+T457*(params(68)*(y(145)+y(146))+(1-params(14))*params(101)*y(193))-y(32)-y(161)*(1-params(7))/(1-params(8));
residual(26)= lhs-rhs;
lhs =y(192);
rhs =y(160)+y(188)+T476*(params(68)*(y(144)+y(146))+(1-params(13))*params(102)*y(194))-y(33)-y(161)*(1-params(7))/(1-params(8));
residual(27)= lhs-rhs;
lhs =y(193);
rhs =(1+crho__)*(T33*(T31*y(153)+T29*y(152))-y(153))+y(147)+(T48*y(161)+y(153)-y(6))*T492-(T217+y(305)-y(153))*T495-y(164);
residual(28)= lhs-rhs;
lhs =y(194);
rhs =(1+crho__)*(T33*(T31*y(153)+T29*y(152))-y(152))+y(147)+(y(152)-y(5)+T48*y(161))*T492-(T217+y(304)-y(152))*T495-y(164);
residual(29)= lhs-rhs;
lhs =y(160);
rhs =params(29)*y(13)+x(it_, 1)+y(44)+y(61)+y(68);
residual(30)= lhs-rhs;
lhs =y(205);
rhs =x(it_, 27);
residual(31)= lhs-rhs;
lhs =y(206);
rhs =x(it_, 28);
residual(32)= lhs-rhs;
lhs =y(207);
rhs =x(it_, 29);
residual(33)= lhs-rhs;
lhs =y(168);
rhs =params(36)*y(21)+x(it_, 15)+y(71)+y(78);
residual(34)= lhs-rhs;
lhs =y(215);
rhs =x(it_, 36);
residual(35)= lhs-rhs;
lhs =y(216);
rhs =x(it_, 37);
residual(36)= lhs-rhs;
lhs =y(161);
rhs =params(30)*y(14)+x(it_, 2)+y(47)+y(81)+y(88);
residual(37)= lhs-rhs;
lhs =y(208);
rhs =x(it_, 30);
residual(38)= lhs-rhs;
lhs =y(209);
rhs =x(it_, 31);
residual(39)= lhs-rhs;
lhs =y(210);
rhs =x(it_, 32);
residual(40)= lhs-rhs;
lhs =y(169);
rhs =params(37)*y(22)+x(it_, 14)+y(91)+y(98);
residual(41)= lhs-rhs;
lhs =y(217);
rhs =x(it_, 38);
residual(42)= lhs-rhs;
lhs =y(218);
rhs =x(it_, 39);
residual(43)= lhs-rhs;
lhs =y(162);
rhs =params(31)*y(15)+x(it_, 3);
residual(44)= lhs-rhs;
lhs =y(163);
rhs =params(32)*y(16)+x(it_, 10);
residual(45)= lhs-rhs;
lhs =y(164);
rhs =params(33)*y(17)+x(it_, 13);
residual(46)= lhs-rhs;
lhs =y(165);
rhs =params(34)*y(18)+x(it_, 4);
residual(47)= lhs-rhs;
lhs =y(184);
rhs =params(48)*y(25)+y(182)-params(6)*y(23);
residual(48)= lhs-rhs;
lhs =y(182);
rhs =x(it_, 5);
residual(49)= lhs-rhs;
lhs =y(185);
rhs =params(49)*y(26)+y(183)-params(5)*y(24);
residual(50)= lhs-rhs;
lhs =y(183);
rhs =x(it_, 6);
residual(51)= lhs-rhs;
lhs =y(166);
rhs =params(35)*y(19)+y(167)-params(4)*y(20);
residual(52)= lhs-rhs;
lhs =y(167);
rhs =x(it_, 7);
residual(53)= lhs-rhs;
lhs =y(186);
rhs =params(50)*y(27)+x(it_, 16);
residual(54)= lhs-rhs;
lhs =y(189);
rhs =params(54)*y(30)+x(it_, 8);
residual(55)= lhs-rhs;
lhs =y(190);
rhs =params(55)*y(31)+x(it_, 9);
residual(56)= lhs-rhs;
lhs =y(187);
rhs =params(38)*y(28)+x(it_, 11)+y(34)+y(99)+y(101)+y(104)-y(111);
residual(57)= lhs-rhs;
lhs =y(195);
rhs =x(it_, 17);
residual(58)= lhs-rhs;
lhs =y(196);
rhs =x(it_, 18);
residual(59)= lhs-rhs;
lhs =y(197);
rhs =x(it_, 19);
residual(60)= lhs-rhs;
lhs =y(198);
rhs =x(it_, 20);
residual(61)= lhs-rhs;
lhs =y(199);
rhs =x(it_, 21);
residual(62)= lhs-rhs;
lhs =y(188);
rhs =params(39)*y(29)+x(it_, 12)+y(39)+y(112)+y(114)+y(117)+y(124);
residual(63)= lhs-rhs;
lhs =y(200);
rhs =x(it_, 22);
residual(64)= lhs-rhs;
lhs =y(201);
rhs =x(it_, 23);
residual(65)= lhs-rhs;
lhs =y(202);
rhs =x(it_, 24);
residual(66)= lhs-rhs;
lhs =y(203);
rhs =x(it_, 25);
residual(67)= lhs-rhs;
lhs =y(204);
rhs =x(it_, 26);
residual(68)= lhs-rhs;
lhs =y(211);
rhs =params(64)*y(50)+x(it_, 33)+y(127)+y(134);
residual(69)= lhs-rhs;
lhs =y(212);
rhs =x(it_, 34);
residual(70)= lhs-rhs;
lhs =y(213);
rhs =x(it_, 35);
residual(71)= lhs-rhs;
lhs =y(219);
rhs =params(65)*y(57)+x(it_, 40);
residual(72)= lhs-rhs;
lhs =y(220);
rhs =params(52)*y(58)+x(it_, 42);
residual(73)= lhs-rhs;
lhs =y(170);
rhs =y(160)+y(155)-y(8)+T157*y(161);
residual(74)= lhs-rhs;
lhs =y(171);
rhs =T157*y(161)+y(160)+y(151)-y(4);
residual(75)= lhs-rhs;
lhs =y(172);
rhs =T48*y(161)+y(154)-y(7);
residual(76)= lhs-rhs;
lhs =y(173);
rhs =y(160)+y(147)-y(3)+y(161)*(params(7)-1)/(1-params(8));
residual(77)= lhs-rhs;
lhs =y(174);
rhs =T157*y(161)+y(160)+y(158)-y(11);
residual(78)= lhs-rhs;
lhs =y(177);
rhs =y(156);
residual(79)= lhs-rhs;
lhs =y(178);
rhs =y(157);
residual(80)= lhs-rhs;
lhs =y(176);
rhs =y(159);
residual(81)= lhs-rhs;
lhs =y(175);
rhs =y(137)+log(params(46));
residual(82)= lhs-rhs;
lhs =y(181);
rhs =y(159)-y(306);
residual(83)= lhs-rhs;
lhs =y(180);
rhs =exp(y(314))*exp(y(306))-exp(y(176));
residual(84)= lhs-rhs;
lhs =y(179);
rhs =exp(y(306))*exp(y(313))-exp(y(176));
residual(85)= lhs-rhs;
lhs =y(214);
rhs =y(219)+(1-params(66))*(y(160)+y(168)-y(21))+params(66)*(y(161)+y(169)-y(22))+y(211)-y(50);
residual(86)= lhs-rhs;
lhs =y(221);
rhs =y(45);
residual(87)= lhs-rhs;
lhs =y(222);
rhs =y(59);
residual(88)= lhs-rhs;
lhs =y(223);
rhs =y(60);
residual(89)= lhs-rhs;
lhs =y(224);
rhs =y(46);
residual(90)= lhs-rhs;
lhs =y(225);
rhs =y(62);
residual(91)= lhs-rhs;
lhs =y(226);
rhs =y(63);
residual(92)= lhs-rhs;
lhs =y(227);
rhs =y(64);
residual(93)= lhs-rhs;
lhs =y(228);
rhs =y(65);
residual(94)= lhs-rhs;
lhs =y(229);
rhs =y(66);
residual(95)= lhs-rhs;
lhs =y(230);
rhs =y(67);
residual(96)= lhs-rhs;
lhs =y(231);
rhs =y(53);
residual(97)= lhs-rhs;
lhs =y(232);
rhs =y(69);
residual(98)= lhs-rhs;
lhs =y(233);
rhs =y(70);
residual(99)= lhs-rhs;
lhs =y(234);
rhs =y(54);
residual(100)= lhs-rhs;
lhs =y(235);
rhs =y(72);
residual(101)= lhs-rhs;
lhs =y(236);
rhs =y(73);
residual(102)= lhs-rhs;
lhs =y(237);
rhs =y(74);
residual(103)= lhs-rhs;
lhs =y(238);
rhs =y(75);
residual(104)= lhs-rhs;
lhs =y(239);
rhs =y(76);
residual(105)= lhs-rhs;
lhs =y(240);
rhs =y(77);
residual(106)= lhs-rhs;
lhs =y(241);
rhs =y(48);
residual(107)= lhs-rhs;
lhs =y(242);
rhs =y(79);
residual(108)= lhs-rhs;
lhs =y(243);
rhs =y(80);
residual(109)= lhs-rhs;
lhs =y(244);
rhs =y(49);
residual(110)= lhs-rhs;
lhs =y(245);
rhs =y(82);
residual(111)= lhs-rhs;
lhs =y(246);
rhs =y(83);
residual(112)= lhs-rhs;
lhs =y(247);
rhs =y(84);
residual(113)= lhs-rhs;
lhs =y(248);
rhs =y(85);
residual(114)= lhs-rhs;
lhs =y(249);
rhs =y(86);
residual(115)= lhs-rhs;
lhs =y(250);
rhs =y(87);
residual(116)= lhs-rhs;
lhs =y(251);
rhs =y(55);
residual(117)= lhs-rhs;
lhs =y(252);
rhs =y(89);
residual(118)= lhs-rhs;
lhs =y(253);
rhs =y(90);
residual(119)= lhs-rhs;
lhs =y(254);
rhs =y(56);
residual(120)= lhs-rhs;
lhs =y(255);
rhs =y(92);
residual(121)= lhs-rhs;
lhs =y(256);
rhs =y(93);
residual(122)= lhs-rhs;
lhs =y(257);
rhs =y(94);
residual(123)= lhs-rhs;
lhs =y(258);
rhs =y(95);
residual(124)= lhs-rhs;
lhs =y(259);
rhs =y(96);
residual(125)= lhs-rhs;
lhs =y(260);
rhs =y(97);
residual(126)= lhs-rhs;
lhs =y(261);
rhs =y(35);
residual(127)= lhs-rhs;
lhs =y(262);
rhs =y(36);
residual(128)= lhs-rhs;
lhs =y(263);
rhs =y(100);
residual(129)= lhs-rhs;
lhs =y(264);
rhs =y(37);
residual(130)= lhs-rhs;
lhs =y(265);
rhs =y(102);
residual(131)= lhs-rhs;
lhs =y(266);
rhs =y(103);
residual(132)= lhs-rhs;
lhs =y(267);
rhs =y(38);
residual(133)= lhs-rhs;
lhs =y(268);
rhs =y(105);
residual(134)= lhs-rhs;
lhs =y(269);
rhs =y(106);
residual(135)= lhs-rhs;
lhs =y(270);
rhs =y(107);
residual(136)= lhs-rhs;
lhs =y(271);
rhs =y(108);
residual(137)= lhs-rhs;
lhs =y(272);
rhs =y(109);
residual(138)= lhs-rhs;
lhs =y(273);
rhs =y(110);
residual(139)= lhs-rhs;
lhs =y(274);
rhs =y(40);
residual(140)= lhs-rhs;
lhs =y(275);
rhs =y(41);
residual(141)= lhs-rhs;
lhs =y(276);
rhs =y(113);
residual(142)= lhs-rhs;
lhs =y(277);
rhs =y(42);
residual(143)= lhs-rhs;
lhs =y(278);
rhs =y(115);
residual(144)= lhs-rhs;
lhs =y(279);
rhs =y(116);
residual(145)= lhs-rhs;
lhs =y(280);
rhs =y(43);
residual(146)= lhs-rhs;
lhs =y(281);
rhs =y(118);
residual(147)= lhs-rhs;
lhs =y(282);
rhs =y(119);
residual(148)= lhs-rhs;
lhs =y(283);
rhs =y(120);
residual(149)= lhs-rhs;
lhs =y(284);
rhs =y(121);
residual(150)= lhs-rhs;
lhs =y(285);
rhs =y(122);
residual(151)= lhs-rhs;
lhs =y(286);
rhs =y(123);
residual(152)= lhs-rhs;
lhs =y(287);
rhs =y(51);
residual(153)= lhs-rhs;
lhs =y(288);
rhs =y(125);
residual(154)= lhs-rhs;
lhs =y(289);
rhs =y(126);
residual(155)= lhs-rhs;
lhs =y(290);
rhs =y(52);
residual(156)= lhs-rhs;
lhs =y(291);
rhs =y(128);
residual(157)= lhs-rhs;
lhs =y(292);
rhs =y(129);
residual(158)= lhs-rhs;
lhs =y(293);
rhs =y(130);
residual(159)= lhs-rhs;
lhs =y(294);
rhs =y(131);
residual(160)= lhs-rhs;
lhs =y(295);
rhs =y(132);
residual(161)= lhs-rhs;
lhs =y(296);
rhs =y(133);
residual(162)= lhs-rhs;
if nargout >= 2,
  g1 = zeros(162, 356);

  %
  % Jacobian matrix
  %

  g1(1,135)=(-(params(88)*(1-params(8))));
  g1(1,139)=(-(params(88)*params(8)));
  g1(1,154)=1;
  g1(1,169)=(-params(88));
  g1(1,211)=(-params(88));
  g1(2,152)=(-(T29*T33));
  g1(2,153)=(-(T31*T33));
  g1(2,154)=1;
  g1(3,136)=(-(params(88)*(1-params(7))));
  g1(3,138)=(-(params(88)*params(7)));
  g1(3,144)=params(68)*params(80)/params(75)*T52;
  g1(3,145)=T52*params(68)*params(81)/params(75);
  g1(3,151)=1;
  g1(3,168)=(-params(88));
  g1(3,211)=(-params(88));
  g1(4,142)=1;
  g1(4,146)=(-params(7));
  g1(4,158)=(-(1-params(7)));
  g1(4,168)=1;
  g1(4,211)=1;
  g1(5,143)=1;
  g1(5,146)=(-params(8));
  g1(5,147)=1;
  g1(5,158)=(-(1-params(8)));
  g1(5,169)=1;
  g1(5,211)=1;
  g1(6,136)=T3;
  g1(6,138)=1;
  g1(6,146)=1;
  g1(6,158)=T3;
  g1(7,135)=T3;
  g1(7,139)=1;
  g1(7,146)=1;
  g1(7,158)=T3;
  g1(8,142)=(-((1-params(20))*(1-params(85)*params(20))/((1+params(85)*params(19))*params(20))));
  g1(8,9)=(-(params(19)/(1+params(85)*params(19))));
  g1(8,156)=1;
  g1(8,306)=(-(params(85)/(1+params(85)*params(19))));
  g1(8,184)=T3;
  g1(8,186)=T3-((-(params(85)/(1+params(85)*params(19))))-params(19)/(1+params(85)*params(19)));
  g1(9,143)=(-((1-params(22))*(1-params(85)*params(22))/((1+params(85)*params(21))*params(22))));
  g1(9,10)=(-(params(21)/(1+params(85)*params(21))));
  g1(9,157)=1;
  g1(9,307)=(-(params(85)/(1+params(85)*params(21))));
  g1(9,185)=T3;
  g1(9,186)=T3-((-(params(85)/(1+params(85)*params(21))))-params(21)/(1+params(85)*params(21)));
  g1(10,148)=1;
  g1(10,4)=(-(params(16)*T160/((T160-params(85)*params(16))*(T160-params(16)))));
  g1(10,151)=T173;
  g1(10,303)=(-(params(85)*params(16)*T160/((T160-params(85)*params(16))*(T160-params(16)))));
  g1(10,160)=(-((params(85)*params(16)*T160*params(29)-params(16)*T160)/((T160-params(85)*params(16))*(T160-params(16)))));
  g1(10,161)=(-T195);
  g1(10,162)=T3;
  g1(11,148)=1;
  g1(11,300)=T3;
  g1(11,306)=1;
  g1(11,159)=T3;
  g1(11,309)=1;
  g1(11,310)=T157;
  g1(12,297)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,299)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,300)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,149)=1;
  g1(12,301)=(-(T52*params(85)*(1-params(13))));
  g1(12,310)=(-((-T48)*T52*params(85)*(1-params(13))+(-T48)*(1-T52*params(85)*(1-params(13)))));
  g1(12,312)=(-(T52*params(85)*(1-params(13))+1-T52*params(85)*(1-params(13))));
  g1(13,298)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,299)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,300)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,150)=1;
  g1(13,302)=(-(T52*params(85)*(1-params(14))));
  g1(13,310)=(-((-T48)*T52*params(85)*(1-params(14))+(-T48)*(1-T52*params(85)*(1-params(14)))));
  g1(13,311)=(-(T52*params(85)*(1-params(14))+1-T52*params(85)*(1-params(14))));
  g1(14,144)=(-params(9));
  g1(14,146)=1;
  g1(15,145)=(-params(10));
  g1(15,146)=1;
  g1(16,147)=1;
  g1(16,148)=1;
  g1(16,149)=T3;
  g1(16,5)=(-(exp(2*T48*params(87))*params(12)));
  g1(16,152)=(-((-(params(12)*params(85)*exp(2*T48*params(87))))-exp(2*T48*params(87))*params(12)-(1+crho__)*(T29*T33-1)));
  g1(16,304)=(-(params(12)*params(85)*exp(2*T48*params(87))));
  g1(16,153)=T31*T33*(1+crho__);
  g1(16,161)=T48*exp(2*T48*params(87))*params(12);
  g1(16,310)=(-(T48*params(12)*params(85)*exp(2*T48*params(87))));
  g1(16,164)=T3;
  g1(17,147)=1;
  g1(17,148)=1;
  g1(17,150)=T3;
  g1(17,152)=T29*T33*(1+crho__);
  g1(17,6)=(-(exp(2*T48*params(87))*params(12)));
  g1(17,153)=(-((-(params(12)*params(85)*exp(2*T48*params(87))))-exp(2*T48*params(87))*params(12)-(1+crho__)*(T31*T33-1)));
  g1(17,305)=(-(params(12)*params(85)*exp(2*T48*params(87))));
  g1(17,161)=T48*exp(2*T48*params(87))*params(12);
  g1(17,310)=(-(T48*params(12)*params(85)*exp(2*T48*params(87))));
  g1(17,164)=T3;
  g1(18,139)=1;
  g1(18,1)=T3;
  g1(18,144)=T3;
  g1(18,161)=T48;
  g1(18,188)=T3;
  g1(19,138)=1;
  g1(19,2)=T3;
  g1(19,145)=T3;
  g1(19,161)=T48;
  g1(19,187)=T3;
  g1(20,1)=(-(params(80)*T52*(1-params(13))));
  g1(20,140)=params(81);
  g1(20,2)=(-(params(81)*T52*(1-params(14))));
  g1(20,141)=params(81);
  g1(20,154)=(-(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13))));
  g1(20,161)=(-(T52*(1-params(14))*(-(T48*params(81)))+T52*(1-params(13))*(-(params(80)*T48))));
  g1(20,164)=(-(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13))));
  g1(20,187)=(-(params(81)*T52*(1-params(14))));
  g1(20,188)=(-(params(80)*T52*(1-params(13))));
  g1(21,137)=T366*(-params(23));
  g1(21,148)=T366;
  g1(21,9)=(-T375);
  g1(21,156)=T380;
  g1(21,306)=(-T349);
  g1(21,11)=(-(1/(1+params(85))));
  g1(21,158)=1-(-T366);
  g1(21,308)=(-T349);
  g1(21,13)=(-T375);
  g1(21,160)=(1+params(85)*params(17)-params(85)*params(29))/(1+params(85));
  g1(21,14)=(-(T157*T375));
  g1(21,161)=T157*(1+params(85)*params(17)-params(85)*params(30))/(1+params(85));
  g1(21,162)=(-T366);
  g1(21,166)=T3;
  g1(21,186)=(-((-T375)-(-T380)-T349));
  g1(22,135)=(-(params(74)/params(46)));
  g1(22,136)=(-(params(73)/params(46)));
  g1(22,137)=1;
  g1(23,147)=(-(params(69)*params(76)/params(82)));
  g1(23,151)=(-(params(75)/params(82)));
  g1(23,154)=(-(params(69)*params(76)/params(82)));
  g1(23,155)=1;
  g1(23,163)=T3;
  g1(24,8)=(1-params(28))*params(26);
  g1(24,155)=(-((1-params(28))*params(26)));
  g1(24,156)=(-(params(25)*(1-params(28))));
  g1(24,12)=(-params(28));
  g1(24,159)=1;
  g1(24,165)=T3;
  g1(25,3)=1;
  g1(25,147)=T3;
  g1(25,156)=T3;
  g1(25,157)=1;
  g1(26,145)=(-(params(68)*T457));
  g1(26,146)=(-(params(68)*T457));
  g1(26,160)=T3;
  g1(26,161)=(1-params(7))/(1-params(8));
  g1(26,187)=T3;
  g1(26,191)=1;
  g1(26,32)=1;
  g1(26,193)=(-((1-params(14))*params(101)*T457));
  g1(27,144)=(-(params(68)*T476));
  g1(27,146)=(-(params(68)*T476));
  g1(27,160)=T3;
  g1(27,161)=(1-params(7))/(1-params(8));
  g1(27,188)=T3;
  g1(27,192)=1;
  g1(27,33)=1;
  g1(27,194)=(-((1-params(13))*params(102)*T476));
  g1(28,147)=T3;
  g1(28,152)=(-(T29*T33*(1+crho__)));
  g1(28,6)=T492;
  g1(28,153)=(-(T492-(-T495)+(1+crho__)*(T31*T33-1)));
  g1(28,305)=T495;
  g1(28,161)=(-(T48*T492));
  g1(28,310)=T48*T495;
  g1(28,164)=1;
  g1(28,193)=1;
  g1(29,147)=T3;
  g1(29,5)=T492;
  g1(29,152)=(-((1+crho__)*(T29*T33-1)+T492-(-T495)));
  g1(29,304)=T495;
  g1(29,153)=(-(T31*T33*(1+crho__)));
  g1(29,161)=(-(T48*T492));
  g1(29,310)=T48*T495;
  g1(29,164)=1;
  g1(29,194)=1;
  g1(30,13)=(-params(29));
  g1(30,160)=1;
  g1(30,44)=T3;
  g1(30,315)=T3;
  g1(30,61)=T3;
  g1(30,68)=T3;
  g1(31,205)=1;
  g1(31,341)=T3;
  g1(32,206)=1;
  g1(32,342)=T3;
  g1(33,207)=1;
  g1(33,343)=T3;
  g1(34,21)=(-params(36));
  g1(34,168)=1;
  g1(34,329)=T3;
  g1(34,71)=T3;
  g1(34,78)=T3;
  g1(35,215)=1;
  g1(35,350)=T3;
  g1(36,216)=1;
  g1(36,351)=T3;
  g1(37,14)=(-params(30));
  g1(37,161)=1;
  g1(37,47)=T3;
  g1(37,316)=T3;
  g1(37,81)=T3;
  g1(37,88)=T3;
  g1(38,208)=1;
  g1(38,344)=T3;
  g1(39,209)=1;
  g1(39,345)=T3;
  g1(40,210)=1;
  g1(40,346)=T3;
  g1(41,22)=(-params(37));
  g1(41,169)=1;
  g1(41,328)=T3;
  g1(41,91)=T3;
  g1(41,98)=T3;
  g1(42,217)=1;
  g1(42,352)=T3;
  g1(43,218)=1;
  g1(43,353)=T3;
  g1(44,15)=(-params(31));
  g1(44,162)=1;
  g1(44,317)=T3;
  g1(45,16)=(-params(32));
  g1(45,163)=1;
  g1(45,324)=T3;
  g1(46,17)=(-params(33));
  g1(46,164)=1;
  g1(46,327)=T3;
  g1(47,18)=(-params(34));
  g1(47,165)=1;
  g1(47,318)=T3;
  g1(48,23)=params(6);
  g1(48,182)=T3;
  g1(48,25)=(-params(48));
  g1(48,184)=1;
  g1(49,182)=1;
  g1(49,319)=T3;
  g1(50,24)=params(5);
  g1(50,183)=T3;
  g1(50,26)=(-params(49));
  g1(50,185)=1;
  g1(51,183)=1;
  g1(51,320)=T3;
  g1(52,19)=(-params(35));
  g1(52,166)=1;
  g1(52,20)=params(4);
  g1(52,167)=T3;
  g1(53,167)=1;
  g1(53,321)=T3;
  g1(54,27)=(-params(50));
  g1(54,186)=1;
  g1(54,330)=T3;
  g1(55,30)=(-params(54));
  g1(55,189)=1;
  g1(55,322)=T3;
  g1(56,31)=(-params(55));
  g1(56,190)=1;
  g1(56,323)=T3;
  g1(57,28)=(-params(38));
  g1(57,187)=1;
  g1(57,34)=T3;
  g1(57,325)=T3;
  g1(57,99)=T3;
  g1(57,101)=T3;
  g1(57,104)=T3;
  g1(57,111)=1;
  g1(58,195)=1;
  g1(58,331)=T3;
  g1(59,196)=1;
  g1(59,332)=T3;
  g1(60,197)=1;
  g1(60,333)=T3;
  g1(61,198)=1;
  g1(61,334)=T3;
  g1(62,199)=1;
  g1(62,335)=T3;
  g1(63,29)=(-params(39));
  g1(63,188)=1;
  g1(63,39)=T3;
  g1(63,326)=T3;
  g1(63,112)=T3;
  g1(63,114)=T3;
  g1(63,117)=T3;
  g1(63,124)=T3;
  g1(64,200)=1;
  g1(64,336)=T3;
  g1(65,201)=1;
  g1(65,337)=T3;
  g1(66,202)=1;
  g1(66,338)=T3;
  g1(67,203)=1;
  g1(67,339)=T3;
  g1(68,204)=1;
  g1(68,340)=T3;
  g1(69,50)=(-params(64));
  g1(69,211)=1;
  g1(69,347)=T3;
  g1(69,127)=T3;
  g1(69,134)=T3;
  g1(70,212)=1;
  g1(70,348)=T3;
  g1(71,213)=1;
  g1(71,349)=T3;
  g1(72,57)=(-params(65));
  g1(72,219)=1;
  g1(72,354)=T3;
  g1(73,58)=(-params(52));
  g1(73,220)=1;
  g1(73,356)=T3;
  g1(74,8)=1;
  g1(74,155)=T3;
  g1(74,160)=T3;
  g1(74,161)=(-T157);
  g1(74,170)=1;
  g1(75,4)=1;
  g1(75,151)=T3;
  g1(75,160)=T3;
  g1(75,161)=(-T157);
  g1(75,171)=1;
  g1(76,7)=1;
  g1(76,154)=T3;
  g1(76,161)=(-T48);
  g1(76,172)=1;
  g1(77,3)=1;
  g1(77,147)=T3;
  g1(77,160)=T3;
  g1(77,161)=(-((params(7)-1)/(1-params(8))));
  g1(77,173)=1;
  g1(78,11)=1;
  g1(78,158)=T3;
  g1(78,160)=T3;
  g1(78,161)=(-T157);
  g1(78,174)=1;
  g1(79,156)=T3;
  g1(79,177)=1;
  g1(80,157)=T3;
  g1(80,178)=1;
  g1(81,159)=T3;
  g1(81,176)=1;
  g1(82,137)=T3;
  g1(82,175)=1;
  g1(83,306)=1;
  g1(83,159)=T3;
  g1(83,181)=1;
  g1(84,306)=(-(exp(y(314))*exp(y(306))));
  g1(84,176)=exp(y(176));
  g1(84,180)=1;
  g1(84,314)=(-(exp(y(314))*exp(y(306))));
  g1(85,306)=(-(exp(y(306))*exp(y(313))));
  g1(85,176)=exp(y(176));
  g1(85,179)=1;
  g1(85,313)=(-(exp(y(306))*exp(y(313))));
  g1(86,160)=(-(1-params(66)));
  g1(86,161)=(-params(66));
  g1(86,21)=1-params(66);
  g1(86,168)=(-(1-params(66)));
  g1(86,22)=params(66);
  g1(86,169)=(-params(66));
  g1(86,50)=1;
  g1(86,211)=T3;
  g1(86,214)=1;
  g1(86,219)=T3;
  g1(87,45)=T3;
  g1(87,221)=1;
  g1(88,59)=T3;
  g1(88,222)=1;
  g1(89,60)=T3;
  g1(89,223)=1;
  g1(90,46)=T3;
  g1(90,224)=1;
  g1(91,62)=T3;
  g1(91,225)=1;
  g1(92,63)=T3;
  g1(92,226)=1;
  g1(93,64)=T3;
  g1(93,227)=1;
  g1(94,65)=T3;
  g1(94,228)=1;
  g1(95,66)=T3;
  g1(95,229)=1;
  g1(96,67)=T3;
  g1(96,230)=1;
  g1(97,53)=T3;
  g1(97,231)=1;
  g1(98,69)=T3;
  g1(98,232)=1;
  g1(99,70)=T3;
  g1(99,233)=1;
  g1(100,54)=T3;
  g1(100,234)=1;
  g1(101,72)=T3;
  g1(101,235)=1;
  g1(102,73)=T3;
  g1(102,236)=1;
  g1(103,74)=T3;
  g1(103,237)=1;
  g1(104,75)=T3;
  g1(104,238)=1;
  g1(105,76)=T3;
  g1(105,239)=1;
  g1(106,77)=T3;
  g1(106,240)=1;
  g1(107,48)=T3;
  g1(107,241)=1;
  g1(108,79)=T3;
  g1(108,242)=1;
  g1(109,80)=T3;
  g1(109,243)=1;
  g1(110,49)=T3;
  g1(110,244)=1;
  g1(111,82)=T3;
  g1(111,245)=1;
  g1(112,83)=T3;
  g1(112,246)=1;
  g1(113,84)=T3;
  g1(113,247)=1;
  g1(114,85)=T3;
  g1(114,248)=1;
  g1(115,86)=T3;
  g1(115,249)=1;
  g1(116,87)=T3;
  g1(116,250)=1;
  g1(117,55)=T3;
  g1(117,251)=1;
  g1(118,89)=T3;
  g1(118,252)=1;
  g1(119,90)=T3;
  g1(119,253)=1;
  g1(120,56)=T3;
  g1(120,254)=1;
  g1(121,92)=T3;
  g1(121,255)=1;
  g1(122,93)=T3;
  g1(122,256)=1;
  g1(123,94)=T3;
  g1(123,257)=1;
  g1(124,95)=T3;
  g1(124,258)=1;
  g1(125,96)=T3;
  g1(125,259)=1;
  g1(126,97)=T3;
  g1(126,260)=1;
  g1(127,35)=T3;
  g1(127,261)=1;
  g1(128,36)=T3;
  g1(128,262)=1;
  g1(129,100)=T3;
  g1(129,263)=1;
  g1(130,37)=T3;
  g1(130,264)=1;
  g1(131,102)=T3;
  g1(131,265)=1;
  g1(132,103)=T3;
  g1(132,266)=1;
  g1(133,38)=T3;
  g1(133,267)=1;
  g1(134,105)=T3;
  g1(134,268)=1;
  g1(135,106)=T3;
  g1(135,269)=1;
  g1(136,107)=T3;
  g1(136,270)=1;
  g1(137,108)=T3;
  g1(137,271)=1;
  g1(138,109)=T3;
  g1(138,272)=1;
  g1(139,110)=T3;
  g1(139,273)=1;
  g1(140,40)=T3;
  g1(140,274)=1;
  g1(141,41)=T3;
  g1(141,275)=1;
  g1(142,113)=T3;
  g1(142,276)=1;
  g1(143,42)=T3;
  g1(143,277)=1;
  g1(144,115)=T3;
  g1(144,278)=1;
  g1(145,116)=T3;
  g1(145,279)=1;
  g1(146,43)=T3;
  g1(146,280)=1;
  g1(147,118)=T3;
  g1(147,281)=1;
  g1(148,119)=T3;
  g1(148,282)=1;
  g1(149,120)=T3;
  g1(149,283)=1;
  g1(150,121)=T3;
  g1(150,284)=1;
  g1(151,122)=T3;
  g1(151,285)=1;
  g1(152,123)=T3;
  g1(152,286)=1;
  g1(153,51)=T3;
  g1(153,287)=1;
  g1(154,125)=T3;
  g1(154,288)=1;
  g1(155,126)=T3;
  g1(155,289)=1;
  g1(156,52)=T3;
  g1(156,290)=1;
  g1(157,128)=T3;
  g1(157,291)=1;
  g1(158,129)=T3;
  g1(158,292)=1;
  g1(159,130)=T3;
  g1(159,293)=1;
  g1(160,131)=T3;
  g1(160,294)=1;
  g1(161,132)=T3;
  g1(161,295)=1;
  g1(162,133)=T3;
  g1(162,296)=1;
end
if nargout >= 3,
  %
  % Hessian matrix
  %

  v2 = zeros(10,3);
  v2(1,1)=84;
  v2(1,2)=108886;
  v2(1,3)=(-(exp(y(314))*exp(y(306))));
  v2(2,1)=84;
  v2(2,2)=62476;
  v2(2,3)=exp(y(176));
  v2(3,1)=84;
  v2(3,2)=111734;
  v2(3,3)=(-(exp(y(314))*exp(y(306))));
  v2(4,1)=84;
  v2(4,2)=108894;
  v2(4,3)=  v2(3,3);
  v2(5,1)=84;
  v2(5,2)=111742;
  v2(5,3)=(-(exp(y(314))*exp(y(306))));
  v2(6,1)=85;
  v2(6,2)=108886;
  v2(6,3)=(-(exp(y(306))*exp(y(313))));
  v2(7,1)=85;
  v2(7,2)=62476;
  v2(7,3)=exp(y(176));
  v2(8,1)=85;
  v2(8,2)=111378;
  v2(8,3)=(-(exp(y(306))*exp(y(313))));
  v2(9,1)=85;
  v2(9,2)=108893;
  v2(9,3)=  v2(8,3);
  v2(10,1)=85;
  v2(10,2)=111385;
  v2(10,3)=(-(exp(y(306))*exp(y(313))));
  g2 = sparse(v2(:,1),v2(:,2),v2(:,3),162,126736);
end
if nargout >= 4,
  %
  % Third order derivatives
  %

  g3 = sparse([],[],[],162,45118016);
end
end
